using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Browser;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Navigation;
using Lib.Helper;
using MSIACCSL2.ViewModels;
using WcfService1.DTO;

namespace MSIACCSL2.Views.DeliveryOrderElse
{
    public partial class Index : Page
    {
        public DeliveryOrderElseViewModel VM
        {
            get { return (DeliveryOrderElseViewModel)this.DataContext; }
        }

        public DeliveryOrderElseWrapViewModel WMW
        {
            get { return (this.Resources["POW"] as DeliveryOrderElseWrapViewModel); }
        }

        public Index()
        {
            InitializeComponent();
            DeliveryOrderElseViewModel.OnSearchCompleted = (x) =>
                                          {
                                              this.DataContext = (DeliveryOrderElseViewModel)x;
                                          };
        }

        private void btnPrint_Click(object sender, System.Windows.RoutedEventArgs e)
        {
          
            var DO = (sender as Button).DataContext as DeliveryOrderElseDTO;
            //GlobalVar.OkaSocket.SendMessage(DO.DONo);
            MyButton button = new MyButton(GlobalVar.ReportUrl + "DOElse.aspx?no=" + HttpUtility.UrlEncode(DO.DONo));
            button.ClickMe();
        }

        private void btnSend_Click(object sender, System.Windows.RoutedEventArgs e)
        {
        	VM.SendEmail((sender as Button).DataContext);
        }

    
    }
}


